//检查屏幕是否又鼠标操作
$ = layui.$;
let lastActivityTime = Date.now();

// 监听用户活动
$(document).on('mousemove keydown mousedown', function() {
    lastActivityTime = Date.now();
});
setInterval(function () {
    //获取上次活动时间
    var old = window.localStorage.getItem("lastActivityTime");
    if (old) {
        if (old < lastActivityTime){
            window.localStorage.setItem("lastActivityTime", lastActivityTime);
        }
    }
    else{
        window.localStorage.setItem("lastActivityTime", lastActivityTime);
    }
    
    //console.info('最新用户活动时间：' + window.localStorage.getItem("lastActivityTime"));
},2*1000);